package com.center.growcenterserver.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.center.growcenterserver.model.domain.StudentCourse;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Map;

@Mapper
public interface StudentCourseMapper extends BaseMapper<StudentCourse> {
    void parseAndStoreGrades(String string);

    IPage<Map<String, Object>> findCoursesByStudentId(IPage<Map<String, Object>> page, @Param("studentId") String studentId);

//    List<StudentCourse> selectByCourseId(String courseId);
//    StudentCourse selectByCourseId(String courseId);

    // 根据 courseId 和 studentId 查询 StudentCourse 记录
    StudentCourse selectByCourseIdAndStudentId(@Param("courseId") String courseId, @Param("studentId") String studentId);

    // 更新指定的 StudentCourse 记录
    int updateByCourseIdAndStudentId(@Param("courseId") String courseId, @Param("studentId") String studentId, @Param("rating") Double rating);

}
